package tool.zyk;

import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper;

import java.io.IOException;

public class Main {
    public static void main(String[] args) throws IOException, InterruptedException {
        String connectionString = "192.168.8.51:2181,192.168.8.52:2181,192.168.8.53:2181";
        // ZooKeeper Session 数据超时时间（也就是这个Session关闭后，与这个Session相关的数据在ZooKeeper中保存多信）。
        int sessionTimeout = 3000;
        ZooKeeper zooKeeper = new ZooKeeper(connectionString,
                sessionTimeout,
                new Watcher() {
                    @Override
                    public void process(WatchedEvent watchedEvent) {

                    }
                }
        );
        zooKeeper.close();
    }
}